#!/usr/bin/perl
#file:	hc_linux_memory
#time:	2008.09
#author: joecen
#site:  http://www.joecen.com/hcacti

open(o_mem,"/proc/meminfo") || die "error: can't open file /proc/meminfo";
my @memdata=<o_mem>;
close(o_mem);
my %memory_info;
foreach(@memdata){
	my @sysmem=split(/\s+/,$_);
	chomp(@sysmem);
	$memory_info{$sysmem[0]} = $sysmem[1];
}
my $swapd_use = $memory_info{'SwapTotal:'}-$memory_info{'SwapFree:'};

print "swapd_use=".$swapd_use.",mem_total=".$memory_info{'MemTotal:'}.",mem_free=".$memory_info{'MemFree:'}.",mem_buff=".$memory_info{'Buffers:'}.",mem_cache=".$memory_info{'Cached:'};
